class Person {
  // ts中类必须声明
  public name: string;
  private age: number;
  protected readonly gender?: boolean;
  constructor(name: string, age: number, gender?: boolean) {
    // 初始化
    this.name = name;
    this.age = age;
    this.gender = gender;
  }
  sayHi() {
    console.log(`name: ${this.name}, age: ${this.age}`);
  }
}

class Student extends Person {
  private constructor(name: string, age: number) {
    super(name, age);
    console.log(this.gender);
  }

  static create(name: string, age: number) {
    return new Student(name, age);
  }
}

const tom = new Person("tom", 15, true);
const s = Student.create("sliver", 12);
// console.log(tom.name, tom.age)

export {};
